#include "../server/mylib/include/httplib.h"
#define SERVER_IP "120.46.25.211"
#define SERVER_PORT 8080
// g++ -std=c++11 httplibCli.cc -o http_client -lpthread
int main()
{
    httplib::Client client(SERVER_IP, SERVER_PORT); // 实例化client对象 用于搭建客户端
    auto res = client.Get("/hi");
    std::cout << res->status << std::endl;
    std::cout << res->body << std::endl;

    res = client.Get("/numbers/123");
    std::cout << res->status << std::endl;
    std::cout << res->body << std::endl;

    // httplib::MultipartFormDataItems items = {
    //     {"file", "hello httplib!", "hello.txt", "text/plain"},
    // };

    httplib::MultipartFormData item;
    item.name = "file";
    item.content = "hello httplib!";
    item.filename = "hello.txt";
    item.content_type = "text/plain";

    httplib::MultipartFormDataItems items;
    items.push_back(item);

    res = client.Post("/multipart", items);
    std::cout << res->status << std::endl;
    std::cout << res->body << std::endl;

    return 0;
}